package com.mingqi.enetconnected.primary.mytask.activity;

import android.view.View;

import com.mingqi.enetconnected.R;
import com.mingqi.enetconnected.base.BaseActivity;
import com.mingqi.enetconnected.view.Dialog.single.SinglePickerTimeManager;
import com.mingqi.enetconnected.view.Dialog.single.SinglePickerTimerEmpManager;
import com.mingqi.enetconnected.view.Dialog.single.TimeValue;
import com.mingqi.enetconnected.view.HorizontalLayout;
import com.mingqi.enetconnected.view.HorizontalTextSwitchLayout;
import com.mingqi.enetconnected.view.SingleChoiceLayout;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 改派改约
 */
public class AssginTaskActivity extends BaseActivity {
    @BindView(R.id.single_choice_layout)
    SingleChoiceLayout singleChoiceLayout;
    @BindView(R.id.assgin_layout)
    HorizontalTextSwitchLayout assginLayout;
    @BindView(R.id.order_time)
    HorizontalLayout orderTime;
    @BindView(R.id.service_personnel)
    HorizontalLayout servicePersonnel;

    @Override
    protected int getLayoutID() {
        return R.layout.activity_assgintask;
    }

    @Override
    protected void initView() {
        setTitleName(R.string.change_dispatch);
        List<String> stringList = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            stringList.add("选项：" + i);
        }
        stringList.add("其他");
        singleChoiceLayout.setChoiceData(stringList);


        orderTime.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (assginLayout.getSelectedTab() == 0) {
                    SinglePickerTimeManager singlePickerTimeManager = new SinglePickerTimeManager(AssginTaskActivity.this);
                    singlePickerTimeManager.setTitle(R.string.please_choose_plan_time);
                    singlePickerTimeManager.setOnConfirmListener(new SinglePickerTimeManager.onConfirmClickListener() {
                        @Override
                        public void onClick(TimeValue checkedItemValue) {
                            orderTime.setRightText(checkedItemValue.getValue());
                        }
                    });
                    singlePickerTimeManager.show();
                } else {
                    SinglePickerTimerEmpManager singlePickerTimeManager = new SinglePickerTimerEmpManager(AssginTaskActivity.this);
                    singlePickerTimeManager.setTitle(R.string.please_choose_plan_time);
                    singlePickerTimeManager.setOnConfirmListener(new SinglePickerTimeManager.onConfirmClickListener() {
                        @Override
                        public void onClick(TimeValue checkedItemValue) {
                            orderTime.setRightText(checkedItemValue.getValue());
                            servicePersonnel.setRightText(checkedItemValue.getEmpValue());
                        }
                    });
                    singlePickerTimeManager.show();
                }
            }
        });
    }
}
